#include "Rebar.h"
#include "CommCtrl.h"

Rebar::Rebar()
{
}
Rebar::~Rebar()
{
	DestroyWindow(m_hWnd);
}
bool Rebar::Setup(HWND a_hWnd, HWND a_hChild, HINSTANCE a_hInst, int a_xPos, int a_yPos, int a_width, int a_height)
{
	m_hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, a_xPos, a_yPos, a_width, a_height, a_hWnd, NULL, a_hInst, NULL);
	if(m_hWnd == NULL)
	{
		return false;
	}

	REBARBANDINFO rb;
	ZeroMemory(&rb, sizeof(REBARBANDINFO));
	rb.fMask = RBBIM_STYLE | RBBIM_TEXT | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;
	rb.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;

	rb.lpText = "Test";
	rb.hwndChild = a_hChild;
	rb.cyChild = 24;
	rb.cxMinChild = 3 * 24;
	rb.cyMinChild = 24;
	rb.cx = 0;

    // Add the band that has the toolbar.
    SendMessage(m_hWnd, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rb);

	UpdateWindow(m_hWnd);
	ShowWindow(m_hWnd, SW_SHOW);

	return true;
}